package service

import (
	"context"
	"insighttracking/query/dao"
	"insighttracking/query/model"
)

type _brandService struct {
}

func (s _brandService) GetByNameApi(ctx context.Context, enterpriseId int64, name string) (*model.BrandEntity, error) {
	return dao.BrandEntity.WithContext(ctx).Where(dao.BrandEntity.EnterpriseID.Eq(enterpriseId), dao.BrandEntity.Name.Eq(name)).First()
}

func (s _brandService) CreateApi(ctx context.Context, m *model.BrandEntity) error {
	if err := dao.BrandEntity.WithContext(ctx).Create(m); err != nil {
		return err
	}
	return nil
}

var BrandService = new(_brandService)
